package ai.think.cloud.chat.service.impl;

import ai.think.cloud.chat.service.OpenAiChatService;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.openai.OpenAiChatClient;
import org.springframework.stereotype.Service;

/**
 * @author Acer
 */
@Service
public class OpenAiChatServiceImpl implements OpenAiChatService {


    @Resource(name = "myOpenAiChatClient")
    private OpenAiChatClient chatClient;

    @Override
    public String easyChat(String message) {
        Prompt prompt = new Prompt(message);
        return chatClient.call(prompt).getResult().getOutput().getContent();
    }
}